package org.mini.command
{
	public class SequenceCommandFactory
	{
		public static function sequenceCommands(... rest):AbstractSequenceCommand
		{
			var len:int = rest.length;
			if(len < 1)
			{
				return null;
			}
			
			var returnCmd:AbstractSequenceCommand = rest[0] as AbstractSequenceCommand;
			
			for(var i:int = len-2; i>=0; i--)
			{
				if(i != (len-1)) (rest[i] as AbstractSequenceCommand).nextCommand = (rest[i+1] as AbstractSequenceCommand);
			}
			
			return returnCmd;
		}
	}
}